-
Notifications
You must be signed in to change notification settings - Fork 125
feat(proxy): allow setting allow-lan via API #824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Copilot <[email protected]> Signed-off-by: Yuwei Ba <[email protected]>
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR exposes the allow-lan setting via the HTTP API by making it reloadable at runtime.
- Added an endpoint test to verify getting and setting
allow-lan - Made
allow_lanreloadable inInboundManager(withget_allow_lan/set_allow_lan) - Updated API handlers to include
allow_lanin GET / PATCH/configs
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| clash_lib/tests/api_tests.rs | New async test for GET and PATCH of allow-lan |
| clash_lib/src/config/internal/listener.rs | Removed outdated TODO comment on reloadability |
| clash_lib/src/app/inbound/network_listener.rs | Moved info! logs into spawned tasks |
| clash_lib/src/app/inbound/manager.rs | Added get_allow_lan / set_allow_lan and restart logic |
| clash_lib/src/app/api/handlers/config.rs | Included allow_lan in API GET and PATCH handlers |
Comments suppressed due to low confidence (2)
clash_lib/tests/api_tests.rs:64
- The
format!call uses a named placeholder{configs_url}without passing a corresponding argument, causing a compile error. Change it to a positional placeholder ({} {}) or supplyconfigs_url = configs_url.
"application/json' -d '{\"allow-lan\": false}}' {configs_url}",
clash_lib/src/app/api/handlers/config.rs:210
- Combining
if let Some(...) = ... && ...is invalid Rust syntax. Consider nesting or matching separately, e.g.if let Some(v) = payload.allow_lan { if v != inbound_manager.get_allow_lan().await { ... } }.
if let Some(allow_lan) = payload.allow_lan
🤔 This is a ...
🔗 Related issue link
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge